export const phoneValidator = (phone, show) => {
	//验证手机号
	const re = /^1[3-9]\d{9}$/
	// 手机号不能为空
	if (!phone) {
		show("手机号不能为空", "warning")
		return false
	}
	if (!re.test(phone)) {
		show("手机号格式错误", "error")
		return false
	}
	return true
}


export const pwdValidator = (password, show) => {
	const re = /^(?![0-9]+$)(?![a-zA-Z]+$)[a-zA-Z0-9]{6,16}$/
	//密码验证
	if (password == "") {
		show("密码不能为空", "warning")
		return false
	}
	if (!re.test(password)) {
		show("密码为字母和数字组合", "warning")
		return false
	}
	return true
}


// 验证码验证
export const codeValidator = (code, show) => {
	const codere = /^\d{6}$/

	//验证验证码
	if (code == '') {
		show("请输入验证码", "warning")
		return false
	}
	if (!codere.test(code)) {
		show("验证码格式错误", "error")
		return false
	}
	return true
}
